import java.lang.Exception;

public class OSIdentifier {
	
	private static String OS = System.getProperty("os.name").toLowerCase();
	
	private boolean isWindows() {
		 
		return (OS.indexOf("win") >= 0);
 
	}
 
	private boolean isMac() {
 
		return (OS.indexOf("mac") >= 0);
 
	}
 
	private boolean isUnix() {
 
		return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 );
 
	}
 
	private boolean isSolaris() {
 
		return (OS.indexOf("sunos") >= 0);
 
	}
	
	public String getOs() throws Exception
	{
		if(isSolaris())
		{
			return "solaris";
		}
		else if(isUnix())
		{
			return "unix";
		}
		else if(isMac())
		{
			return "mac";
		}
		else if(isWindows())
		{
			return "windows";
		}
		
		throw new Exception("Did not found OS signature.");
	}
	
 

}
